<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonList.jsp"%>
<html>
<head>
<title>退伙主页面_客服助理、客服经理</title>
<script type="text/javascript" src="${ctx }/scripts/common.js"></script>
<script type="text/javascript" src="${ctx }/scripts/ajaxException.js"></script>
<script type="text/javascript" src="${ctx }/scripts/common/prototype.js"></script>
<script type="text/javascript">
 	 var currentGoOutId;       //当前选中的退伙Id
	 var currentGoOutStatus ;  //当前选中的退伙状态
	 var currentHouseId;
	 var clients;

   //功能描述：保存当前选中的退伙信息
   function setCurrentGoOut(id,status,houseId,clientsName){
      currentGoOutId = id;
      currentGoOutStatus = status;
      currentHouseId = houseId;
      document.getElementById("goOutId").value=id;
      parent.setCurrentGoOutId(id);
      clients=clientsName;
   }

  // 功能描述： 打开"退伙申请详细" 页面
 function openWithdrawDetail(){
   var url = "${ctx}/house_proRightModificationAction.do?method=initGoOutDetail&keyword="+currentGoOutId;
   top.windowOpen(url, "goOutDetail", "退伙申请详细", 560, 700,true,"goOutWinIfm");
 }

  //功能描述： 打开"新增退伙审批表" 页面
  function openWithdrawAdd(){
       var url = "${ctx}/house_proRightModificationAction.do?method=initGoOutAdd";
       top.windowOpen(url, "goOutAdd", "增加退伙申请", 560, 700,true,"goOutAddWinIfm");
 }

  //功能描述：打开"修改退伙申请" 窗口
 function openWithdrawEdit(){
   if(!currentGoOutId){
    	Alert("${key.chooseUpdateData}");
   }else{
		var url = "${ctx}/house_proRightModificationAction.do?method=checkGoOutStatus";
  		new Ajax.Request(url,
    	{
    		method:'post',
    		parameters:{goOutId:currentGoOutId},
    		onSuccess:function(response){
    	     var status = response.responseText;

    	      if(status != "new"){
    	        Alert("${key.noNewStatus_Msg}");
    	      }else{
    	        var url = "${ctx}/house_proRightModificationAction.do?method=initGoOutEdit&goOutId="+currentGoOutId;
          		top.windowOpen(url, "goOutEdit", "修改退伙申请", 560, 700,true,"goOutEditWinIfm");
    	      }
    		}
    		}
    	);
   }
 }

//功能描述：变为历史业主只有退伙状态为审核完毕且各项账房都为0时才能进行此操作
 function modifiyHistory(){
   	var url = "${ctx}/house_proRightModificationAction.do?method=checkGoOutStatus&status="+currentGoOutStatus;
   	new Ajax.Request(url,
   		{
   			method:'post',
   			parameters:{goOutId:currentGoOutId},
   			onSuccess:function(response){
   				var status = response.responseText;
   				if (status !='finish'){
   					Alert('${key.noFinishStatus_Msg}');
   				}else{
   					 AskConfirm("是否要把 "+clients+" 变为历史业主？","proRightModIfm","${ctx}/house_proRightModificationAction.do?method=changeHistoryOwner&keyword="+currentGoOutId);
   				}
   			}
   		}
   	)
 }
	 //进行变为历史业主操作时的跳转
	function refreshHistory(obj){
		if (obj == "moneyNotZero"){ //帐户金额不为0,不能变为历史业主
			Alert("${key.accountNoZero_Msg}");
		}else if (obj == "toHisOwersOK"){ //变为历史业主操作成功
			SuccessAlert("${key.success_Msg}");
			var url = "${ctx }/house_proRightModificationAction.do?method=goOutList";
			window.location.href=url;
		}
	}

   //功能描述：登记新业主
  function openOwnerAdd(){
	var url = "${ctx}/house_proRightModificationAction.do?method=checkHouseGoOutStatus";
	new Ajax.Request(url,
  	{
  		method:'post',
  		parameters:{goOutId:currentGoOutId},
  		onSuccess:function(response){
  	    	var status = response.responseText;
  	      	if(status != "end"){
  	      		Alert("${key.goOutNoOver_Msg}");
  	     	}else{
				var url2 = "${ctx}/customer_ownerAction.do?method=initOwnerAddMain&houseId="+currentHouseId+"&type=goOut";
				top.windowOpen(url2,'addOwner','新增业主资料',620,900,true,"addOwnerFrame");
  	     	}
  	   }
  	});
 }
    // 功能描述：审核
    function auditing(){
      	var url = "${ctx}/house_proRightModificationAction.do?method=checkAudit";
  		new Ajax.Request(url,
    	{
    		method:'post',
    		parameters:{keyword:currentGoOutId,type:'001'},
    		onSuccess:function(response){
    			ajaxSubmitException(response.responseText);
    			var flag = response.responseText;
    			if (flag == "true"){
	    	   		var url = "${ctx}/house_proRightModificationAction.do?method=initGoOutExamine&type=001&goOutId="+currentGoOutId;
	    			top.windowOpen(url,"goOutExamine","退伙申请审核", 560, 700,true,"goOutExamineWinIfm");
	    		}
    		}
    	});
    }

       // 功能描述：反审核
       function antiAudit(){
			var url = "${ctx}/house_proRightModificationAction.do?method=checkAntiAudit";
			new Ajax.Request(url,
			{
				method:'post',
    			parameters:{keyword:currentGoOutId,type:'001'},
    			onSuccess:function(response){
    				ajaxSubmitException(response.responseText);
    				var flag = response.responseText;
    				if (flag == "true"){
    					AskConfirm("${key.isAntiAudit_Msg}","proRightModIfm","${ctx}/house_proRightModificationAction.do?method=antiAudit&type=001&goOutId="+currentGoOutId);
    				}
    			}
			});
       	}

		//提交操作
       function changeSubmit(){
	       	var url = "${ctx}/house_proRightModificationAction.do?method=checkGoOutStatus&status="+currentGoOutStatus;
	   		new Ajax.Request(url,
	   		{
	   			method:'post',
	   			parameters:{goOutId:currentGoOutId},
	   			onSuccess:function(response){
	   				ajaxSubmitException(response.responseText);
	   				var status = response.responseText;
	   				if (status !='new'){
	   					Alert("${key.noSubmit_Msg}");
	   				}else{
						AskConfirm("${key.isSubmit_Msg}","proRightModIfm","${ctx}/house_proRightModificationAction.do?method=changeSubmit&goOutId="+currentGoOutId);
	   				}
	   			}
	   		})
       }

	/**
 	 * 功能描述： 提交成功后刷新列表
 	 */
  function chargeSubmitRef(){
  //	var ec_p = $('ec_p').value;
	var url = "${ctx}/house_proRightModificationAction.do?method=goOutList";
	window.location.href=url;
  }



  /**
  * 功能描述： 刷新列表
  */
  function refreshList(){
	var url = "${ctx}/house_proRightModificationAction.do?method=goOutList";
	window.location.href=url;
  }

  function goOutPrint(){
	 var goOutId = document.getElementById("goOutId").value;
		if (goOutId == "" || goOutId  == null){
			Alert("请选择一条数据");
			return ;
		}
		document.getElementById("printFrom").action ="${ctx}/applets/appletShow.jsp?reportName=GoOutReportService&goOutId="+goOutId;
		document.getElementById("printFrom").submit();

  }
  function clean(){
 		parent.setCurrentGoOutId("");
  }


</script>
</head>
<body onload="clean();">
<form id="printFrom" name="printFrom" method="post"
	  action="" target="_blank">
</form>
<input type="hidden" name="goOutId" id="goOutId" value="">
<input type="hidden" name="ec_p" id="ec_p" value="${pageNo }">
<div   class="tab_bgline" >
<div style="overflow:auto; height:450px;width:100%">
 <ec:ceTable items="goOutList"
	action="${ctx}/house_proRightModificationAction.do?method=goOutList"
	var="goOutItem"
	view="pmsview"
	styleClass="gridData2"
	rowsDisplayed="15" >
	<ec:ceRow styleClass="grid" onclick="setCurrentGoOut('${goOutItem.keyword }','${goOutItem.statuId }','${goOutItem.houseId }','${goOutItem.clients}')" onContextMenu="return ShowContextMenu(event,'quick_rightmenu');" ondblclick="openWithdrawDetail();" >
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.houseNumber}" property="houseNumber" sortable="true" width="10%" />
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.clients }" property="clients" width="10%"/>
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.copyMeterWaterReading }" property="copyMeterWaterReading"  width="10%" cell="number" format="###,##0.00"/>
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.copyMeterAmmeterReading }" property="copyMeterAmmeterReading" width="10%" cell="number" format="###,##0.00" />
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.houseDesc }" property="houseDesc"  width="11%"/>
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.checker }" property="checker"  width="11%"/>
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.goods }" property="goods"  width="11%"/>
		<ec:ceColumn headerCell="pmsHeadrCell" title="${key.statuName }" property="statuName"  width="11%"/>
		<ec:parameter name="houseNumber" value="${houseNumber }"></ec:parameter>
		<ec:parameter name="ownerName" value="${ownerName }"></ec:parameter>
	</ec:ceRow>
</ec:ceTable>
 </div>
 </div>

  <div id="quick_rightmenu" style="display:none;" oncontextmenu="return false" class="quick_menu2" onMouseOver="showmy2menu('quick_rightmenu')"  onMouseOut="hidden2menu('quick_rightmenu')" >
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="grid_quickMenu_bg">
    <tr>
      <td><table width="100%" border="0" cellpadding="2" cellspacing="0">
     <pms:AuthTag authName="house_proRightModificationAction.do?method=initGoOutAdd">
        <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="openWithdrawAdd();"onFocus="this.blur()"><img src="${ctx }/images/ico_newfile.gif" border="0" align="absbottom" alt="${key.add }"/>&nbsp;${key.add }</a></td>
        </tr>
     </pms:AuthTag>
     <pms:AuthTag authName="house_proRightModificationAction.do?method=initGoOutEdit">
        <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="openWithdrawEdit();" onFocus="this.blur()"><img src="${ctx }/images/ico_amend.gif" border="0" align="absbottom" alt="${key.update }"/>&nbsp;${key.update }</a></td>
        </tr>
     </pms:AuthTag>
         <tr>
		   <td class="hrpading"><table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
		     <tr><td class="quickMenu_line"></td></tr></table></td>
          </tr>
        <pms:AuthTag authName="house_proRightModificationAction.do?method=changeSubmit">
		  <tr>
          	<td class="quickMenu_toolbarico"><a href="#"  onClick="changeSubmit();" onFocus="this.blur()"><img src="${ctx }/images/ico_submit.gif" border="0" align="absbottom" alt=" "/>&nbsp;${key.submit }</a></td>
          </tr>
        </pms:AuthTag>

     <pms:AuthTag authName="house_proRightModificationAction.do?method=changeHistoryOwner">
		  <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="modifiyHistory();" onFocus="this.blur()"><img src="${ctx }/images/house_history.gif" border="0" align="absbottom" alt=" "/>&nbsp;${key.modifiyHistory }</a></td>
          </tr>
     </pms:AuthTag>
     <pms:AuthTag authName="menu.nopage.goOutAddOwner">
		  <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="openOwnerAdd();" onFocus="this.blur()"><img src="${ctx }/images/ico_newfile.gif" border="0" align="absbottom" alt=" "/>&nbsp;${key.openOwnerAdd }</a></td>
          </tr>
     </pms:AuthTag>
		   <tr>
		   <td class="hrpading"><table width="95%" border="0" align="left" cellpadding="0" cellspacing="0">
		     <tr><td class="quickMenu_line"></td></tr></table></td>
          </tr>
           <pms:AuthTag authName="house_proRightModificationAction.do?method=initGoOutExamine">
          	  <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="auditing();"onFocus="this.blur()"><img src="${ctx }/images/ico_shenpi_zong1.gif" border="0" align="absbottom" />&nbsp;${key.auditing }</a></td>
          </tr>
          </pms:AuthTag>
          <pms:AuthTag authName="house_proRightModificationAction.do?method=antiAudit">
		   <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onClick="antiAudit();"onFocus="this.blur()"><img src="${ctx }/images/ico_submitunpass.gif" border="0" align="absbottom" />&nbsp;${key.antiAudit }</a></td>
          </tr>
          </pms:AuthTag>
          <tr>
          <td class="quickMenu_toolbarico"><a href="#"  onclick="goOutPrint();"  onFocus="this.blur()"><img src="${ctx }/images/ico_printer.gif" border="0" align="absbottom" alt=" "/>&nbsp;${key.print }</a></td>
          </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html>